<?php
use_stylesheet(plugin_web_path('orangehrmTLUBenefitsPlugin', 'css/addInsuranceAttendSuccess'));
use_javascript(plugin_web_path('orangehrmTLUBenefitsPlugin', 'js/addInsuranceAttendSuccess'));
?>

<div class="box" id="addInsuranceAttend">
    <div class="head">
        <h1><?php echo isset($insuranceAttendId) ? __('Edit Insurance Attend') : __('Add Insurance Attend'); ?></h1>
    </div>

    <div class="inner">
        <?php include_partial('global/flash_messages'); ?>
        <form name="frmAddInsuranceAttend" id="frmAddInsuranceAttend" method="post">
            <?php echo $form['_csrf_token']; ?>
            <fieldset>
                <ol>
                    <li>
                        <?php echo $form['name']->renderLabel(__('Insurance Attend Name') . ' <em>*</em>'); ?>
                        <?php echo $form['name']->render(array("maxlength" => 100)); ?>
                    </li>
                    <li class="largeTextBox">
                        <?php echo $form['description']->renderLabel(__('Description') . ' <em>*</em>'); ?>
                        <?php echo $form['description']->render(array("cols" => 30, "rows" => 10, "maxlength" => 500)); ?>
                    </li>
                    <li class="largeTextBox">
                        <?php echo $form['regulation']->renderLabel(__('Regulation') . ' <em>*</em>'); ?>
                        <?php echo $form['regulation']->render(array("cols" => 30, "rows" => 5, "maxlength" => 100)); ?>
                    </li>
                    <li class="largeTextBox">
                        <?php echo $form['family']->renderLabel(__('Family')); ?>
                        <?php echo $form['family']->render(array("cols" => 30, "rows" => 8, "maxlength" => 400)); ?>
                    </li>
                    <li class="largeTextBox">
                        <?php echo $form['note']->renderLabel(__('Notes'), array('class' => 'firstLabel')); ?>
                        <?php echo $form['note']->render(array("cols" => 30, "rows" => 5, "maxlength" => 200)); ?>
                    </li>
                    <?php if (isset($insuranceAttendId)) { ?>
                        <li>
                            <?php echo $form['creationDate']->renderLabel(__('Creation Date'), array("class " => "appDate")); ?>
                            <?php echo $form['creationDate']->render(array("class" => "formDateInput")); ?>
                        </li>
                    <?php } ?>
                    <?php include_component('core', 'ohrmPluginPannel', array('location' => 'add_layout_before_navigation_bar_1')) ?>

                    <li class="required">
                        <em>*</em> <?php echo __(CommonMessages::REQUIRED_FIELD); ?>
                    </li>
                </ol>
                <p>
                    <?php if (isset($insuranceAttendId)) { ?>
                        <input type="button" class="savebutton" name="btnSave" id="btnSave"
                               value="<?php echo __("Edit"); ?>"/>
                        <input type="button" class="backbutton" name="btnBack" id="btnBack"
                               value="<?php echo __("Back"); ?>"/>
                    <?php } else { ?>
                        <input type="button" class="savebutton" name="btnSave" id="btnSave"
                               value="<?php echo __("Save"); ?>"/>
                    <?php } ?>
                </p>
            </fieldset>
        </form>
    </div>
</div>

<script type="text/javascript">
    //<![CDATA[
    var lang_nameRequired = '<?php echo __(ValidationMessages::REQUIRED); ?>';
    var lang_descriptionRequired = '<?php echo __(ValidationMessages::REQUIRED); ?>';
    var lang_regulationRequired = '<?php echo __(ValidationMessages::REQUIRED); ?>';
    var lang_nameExistmsg = "<?php echo __("Already exists"); ?>";
    var insuranceAttendNames = <?php echo $form->getInsuranceAttendList(); ?>;
    var insuranceAttendNameList = eval(insuranceAttendNames);
    var lang_edit = "<?php echo __("Edit"); ?>";
    var lang_save = "<?php echo __("Save"); ?>";
    var lang_cancel = "<?php echo __("Cancel"); ?>";
    var lang_back = "<?php echo __("Back"); ?>";
    var linkForAddInsuranceAttend = "<?php echo url_for('benefits/addInsuranceAttend'); ?>";
    var lang_descriptionLength = "<?php echo __(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 500)) ?>";
    var lang_regulationLength = "<?php echo __(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 100)) ?>";
    var lang_familyLength = "<?php echo __(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 400)) ?>";
    var lang_noteLength = "<?php echo __(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 200)) ?>";
    var backBtnUrl = '<?php echo url_for('benefits/viewInsuranceAttend?'); ?>';
    var backCancelUrl = '<?php echo url_for('benefits/addInsuranceAttend?'); ?>';
    <?php if (isset($insuranceAttendId)) { ?>
    var insuranceAttendId = '<?php echo $insuranceAttendId; ?>';
    <?php } else { ?>
    var insuranceAttendId = "";
    <?php } ?>
    //]]>
</script>
